﻿using ITXHWEB.Models;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Web.Mvc;
using WPFExcelReport;
using WPFExcelReport.Helpers; 
using ITXHWEB.Infrastructure;
using System.Collections;
using System.Collections.Generic;
namespace ITXHWEB.Controllers
{
    public partial class VKPOSController : ITXController
    {
         
        [ChildActionOnly]
        public ActionResult SVKPART(string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            VKPOSModel vkp = new VKPOSModel(); 
            if(dwVKP!= null)
            {
                vkp.VKPAUF =  dwVKP["VKPAUFPOS"].ToString();
            }
            return PartialView(vkp);
        }
        
        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult SVKPART(VKPOSModel model, string returnUrl)
        {
            if (model.VCOLOR == null)
                model.VCOLOR = "";
            if (model.REMARK == null)
                model.REMARK = "";
            PM["USD2RMB"] = VHP.MRD.USD2RMB;
            PM["RATE1"] = VHP.MRD.RATE1;
            PM["VFART"] = model.VFART;
            PM["VCOLOR"] = model.VCOLOR;
            PM["REMARK"] = model.REMARK;
            PM["dwVKP"] = dwVKP;
            VHP.EXORD.SETVKPBYART(PM);//保存
            INFO += model.VFART.Trim() + ";" + Environment.NewLine;
            PM["dwInput"] = dwVKP;
            PM["KRS"] = "EX";
            PM["LFD"] = Helper.Right("000000" + MORDER, 6);
            VPOS++;
            PM["POS"] = Helper.Right("000" + VPOS, 3);
            PM["CUSTOMER"] = KDKUNDNA.PadRight(40);
            PM["CUSER"] = app.User;
            PM["USD2RMB"] = VHP.MRD.USD2RMB;
            PM["RATE1"] = VHP.MRD.RATE1;
            dwVKP = VHP.EXORD.NEWVKP(PM);//新建
            return RedirectToAction(MAPP, MAPP);
         } 
    }
}
